<template>
  <section class="Home-Page">首页</section>
</template>

<script>

export default {
  data () {
    return {
    };
  },
  onLoad (query) {
  },
  // 下拉刷新
  onPullDownRefresh () {
    this.refreshData();
  },
  // 上拉加载
  onReachBottom () {
    this.loadData();
  },
  methods: {
    refreshData () {
      this.shopList = [];
      this.pageNum = 1;
      this.loadStatus = 'loadmore';
      this.loadData();
    },
    // 加载门店数据
    loadData () {
      if (this.loadStatus == 'loadmore') {
        this.loadStatus = 'loading';
        setTimeout(() => {
          this.loadStatus = 'loadmore';
          uni.stopPullDownRefresh();
          const res = {
            status: true,
            data: []
          }
          if (res.status) {
            this.shopList = this.shopList.concat(res.data);
            if (!this.shopList.length) {
              this.loadStatus = 'empty';
            } else if (res.data.length < this.pageSize) {
              this.loadStatus = 'nomore';
            } else {
              this.pageNum++;
            }
          }
        }, 1000);
      }
    }
  }
};
</script>

<style lang="scss">
.Home-Page {
}
</style>
